﻿@model IEnumerable<Category>

<link rel="stylesheet" type="text/css" href="@Url.Content("~/Modules/Products/Content/Products.less")" />
<script type="text/javascript">
	$(document).ready(function () {
		$("div.categoriesWidget a.pin").click(function () {
			var t = $(this);
			var ul = t.nextAll("ul").eq(0);
			var img = t.find("img");
			var toggle = "/Content/Icons/toggle.png";
			var toggleCollapse = "/Content/Icons/toggle_collapse.png"

			if (ul.data("expanded")) {
				ul.data("expanded", false);
				ul.slideUp("normal");
				img.prop("src", toggle);
				img.prop("alt", "открыть");
			}
			else {
				ul.data("expanded", true);
				ul.slideDown("normal");
				img.prop("src", toggleCollapse);
				img.prop("alt", "закрыть");
			}

			return false;
		});
	});
</script>

<div class="widgetCategories">
	<h3>Каталог</h3>
	@if (Model.Count() > 0)
	{
		@Html.Partial("CategoriesWidgetInner", new CategoriesWidgetModel(Model, true))
	}
	else
	{
		<p>Нет подкатегорий</p>
	}
</div>